/**
  ******************************************************************************
  * @file    LED.c
  * @author  WuGuo
  * @version V1.0.0
  * @date    7-May-2025
  * @brief   Controll MCU LED
  *
  * @note    Portions based on STM32 Standard Peripheral Library (V3.5.0)
  *          Original copyright notice follows:
  ******************************************************************************
  * @attention
  *
  * <h2><center>? COPYRIGHT(c) 2011 STMicroelectronics</center></h2>
  *
  * Licensed under MCD-ST Liberty SW License Agreement V2 (the "License");
  * You may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
  *
  *        http://www.st.com/software_license_agreement_liberty_v2
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
  ******************************************************************************
  */

#include "LED.h"


void LED_Init(void){
	//GPIO Init
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
	
	GPIO_InitTypeDef GPIO_InitStructure;
	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Pin=GPIO_Pin_13;
	GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
	GPIO_Init(GPIOC,&GPIO_InitStructure);
	
	GPIO_SetBits(GPIOC,GPIO_Pin_13);
}
void LED_ON(void){
	GPIO_ResetBits(GPIOC,GPIO_Pin_13);
}
void LED_OFF(void){
    GPIO_SetBits(GPIOC,GPIO_Pin_13);
}
void LED_Turn(void){
	if(GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_13)==0){
	    GPIO_SetBits(GPIOC,GPIO_Pin_13);
	}else{
	    GPIO_ResetBits(GPIOC,GPIO_Pin_13);
	}
}
